<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <input type="text" v-model="uname" @keyup.delete='clearContent'>
        <input type="text" v-model="password" @keyup.enter='handleSubmit'>
        <input type="button" value="提交" @click='handleSubmit'>
    </div>

    <script src="../js/vue.js"></script>
    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                uname: '',
                password: ''
            },
            methods: {
                handleSubmit: function () {
                    console.log('已提交' + this.uname + this.password);
                },
                clearContent: function () {
                    //置空
                    this.uname = '';
                    this.password = '';
                }
            },
        })
    </script>
</body>

</html>